package com.blqy.fr.common.util;

/**
 * 获取当前用户信息帮助类
 */
public class AuthContextHolder {

    private static ThreadLocal<Long> USER_ID = new ThreadLocal<Long>();
    private static ThreadLocal<String> username = new ThreadLocal<String>();
    private static ThreadLocal<Long> TEAM_ID = new ThreadLocal<Long>();

    public static void setUserId(Long userId) { USER_ID.set(userId); }
    public static Long getUserId() { return USER_ID.get(); }
    public static void removeUserId() { USER_ID.remove(); }


    public static void setUsername(String _username) {
        username.set(_username);
    }

    public static String getUsername() {
        return username.get();
    }

    public static void removeUsername() {
        username.remove();
    }


    public static void setTeamId(Long teamId) {
        TEAM_ID.set(teamId);
    }
    public static Long getTeamId() { return TEAM_ID.get(); }
    public static void removeTeamId() { TEAM_ID.remove(); }
}
